package com.huangfuyi.datasource.entity;


import com.huangfuyi.datasource.annotate.ConnectFieldInfo;

import java.io.Serializable;

/**
 * 数据源链接信息
 *
 * */
public class EMySQLConnectConf implements EConnectConf {

    @ConnectFieldInfo(label = "数据源的id", description = "数据源需要缓存时的唯一id，系统自动生成", customize = false)
    private String id;

    @ConnectFieldInfo(label = "ip地址", description = "MySQL数据库所在服务器的ip地址")
    private String ip;

    @ConnectFieldInfo(label = "端口", description = "连接MySQL数据库的端口")
    private int port;

    @ConnectFieldInfo(label = "用户名", description = "登录MySQL数据库的用户名")
    private String userName;

    @ConnectFieldInfo(label = "密码", description = "登录MySQL数据库的密码")
    private String password;

    // 集群情况下链接的优先级，数字越小，优先级越高
    private int priority;

    private int maxPoolSize = 1;

    private ConnectConfig connectConfig = new ConnectConfig();

    public static class ConnectConfig implements Serializable{

        @Override
        public String toString() {
            return "useUnicode=true&characterEncoding=utf-8";
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getPriority() {
        return priority;
    }

    public void setPriority(int priority) {
        this.priority = priority;
    }

    public int getMaxPoolSize() {
        return maxPoolSize;
    }

    public void setMaxPoolSize(int maxPoolSize) {
        this.maxPoolSize = maxPoolSize;
    }

    public ConnectConfig getConnectConfig() {
        return connectConfig;
    }

    public void setConnectConfig(ConnectConfig connectConfig) {
        this.connectConfig = connectConfig;
    }
}
